Lists.py

UP | HOME
print(names[0])

# Add a new name
names.append("Draco")

# Sort names alphabetically
names.sort()

# Print list of names
print(names)

Tratando con listas en Py:

# List of names
names = ["Harry", "Ron", "Hermione", "Ginny"]

# Print first name
print(names[0])

# Add a new name
names.append("Draco")

# Sort names alphabetically
names.sort()

# Print list of names
print(names)

lists-note.png

Author: txarly

Created: 2021-03-06 Sat 18:40

Validate